<script setup lang="ts">
import { onMounted, ref, shallowRef } from "vue";

defineOptions({
  name: "ScrollRanking"
});

const data = shallowRef([
  {
    name: "周口",
    value: 5500
  },
  {
    name: "南阳",
    value: 12000
  },
  {
    name: "西峡",
    value: 7800
  },
  {
    name: "驻马店",
    value: 6600
  },
  {
    name: "新乡",
    value: 8000
  },
  {
    name: "信阳",
    value: 4500
  },
  {
    name: "漯河",
    value: 2900
  },
  {
    name: "广州",
    value: 5500
  },
  {
    name: "深圳",
    value: 12000
  },
  {
    name: "东莞",
    value: 7800
  },
  {
    name: "佛山",
    value: 6600
  },
  {
    name: "惠州",
    value: 8000
  },
  {
    name: "江门",
    value: 4500
  }
]);

const config = shallowRef({
  data: [],
  unit: "万元",
  rowNum: 5,
  waitTime: 2000,
  carousel: "single",
  animationCurve: "easeInOutCubic",
  animationFrame: 50
});

onMounted(() => {
  config.value.data = [...data.value];
});
</script>

<template>
  <div class="box">
    <div class="title">
      <span>NIKE各地月营收占比</span>
    </div>
    <div class="content">
      <div class="chart-wrapper">
        <dv-scroll-ranking-board :config="config" class="scroll-ranking" />
      </div>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.box {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 20px;

  .title {
    flex-shrink: 0;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
  }

  .content {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 0;
    overflow: hidden;

    .chart-wrapper {
      width: 100%;
      height: 100%;
      min-height: 0;
      overflow: hidden;

      .scroll-ranking {
        width: 100%;
        height: 100%;
      }
    }
  }
}
</style>
